#define _CRT_SECURE_NO_DEPRECATE
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string>
using namespace std;
FILE* fp;
unsigned char c;
unsigned int zf = 0, dc = 0, jz = 0;
bool input_m(const char* path)
{
	if ((fp = fopen(path, "rb")) != NULL)
	{
		while ((c = fgetc(fp)) != EOF)
		{
			if (((c <= 'z') && (c >= 'a')) || ((c <= 'Z') && (c >= 'A')))
			{
				zf++;
				dc++;
				while ((c = fgetc(fp)) != EOF)
				{
					if (((c <= 'z') && (c >= 'a')) || ((c <= 'Z') && (c >= 'A')))
					{
						zf++;
					}
					else if ((c == '\n')||(c == '.')||(c == '!')||(c == '?'))
					{
						jz++;
						break;
					}
					else if (c == ' ')
					{
						break;
					}
					else
					{
						break;
					}
				}
			}
			else if (c == ' ')
			{
				dc++;
			}
			else if ((c == '\n')||(c == '.')||(c == '!')||(c == '?'))
			{
				jz++;
			}
			else
			{
				break;
			}
		}
		return 1;
	}
	else
	{
		cout << "无法打开\n提示：输入的文件得是全英文txt\n输入格式为：文件名 m\n" << endl;
		return 0;
	}
}
int main()
{
	char path[1000], m; 
	cout << "请输入：wc.exe -";
    cin >> m;
	cin >> path;
	input_m(path);
	if (m == 'a')
	{
		cout << "字符数为:" << zf << endl;
	}
	else if (m == 'b')
	{
		cout << "单词数为:" << dc << endl;
	}
	else if (m == 'c')
	{
		cout << "句子数为:" << jz << endl;
	}
}